<template>
  <div>
    <div id="in-nav">
      <div class="container">
        <div class="row">
          <div class="span12 comp-ie">
            <a id="logo" href="javascript:void(0);">
              <!--<h4><strong>智慧管理</strong>平台</h4>-->
              <!--<img src="../assets/images/login-title.png"/>-->
            </a>
          </div>
        </div>
      </div>
    </div>
    <div class="bg-img">
      <div class="container">
        <div class="row">

          <div class="col-xs-offset-7">
            <div class="login">
              <!--login begin-->
              <h4 class="login_title">请登录你的账号</h4>
              <!--<form class="form-horizontal">-->
                <div class="form-group">
                  <!--账号-->
                  <span>账号:</span>
                  <i class="icon i_user"></i>
                  <input type="text" class="input" name="username" id="inputUser" placeholder="请输入你的用户名"
                         v-model="account">
                </div>

                <div class="form-group">
                  <!--密码-->
                  <span>密码:</span>
                  <i class="icon i_psw"></i>
                  <input type="password" class="input" name="password" id="inputPsw" placeholder="请输入你的密码"
                         v-model="checkPass">
                </div>

                <div class="form-group">
                  <!--记住我-->
                  <div class="checkbox" style="padding-right: 20px;">
                    <label>
                      <input type="checkbox">记住我
                    </label>
                  </div>
                </div>
                <div class="form-group">
                  <!--登录按钮-->
                  <button class="btn btn-primary btn-sub" @click="handleSubmit2()">登录</button>
                </div>
              <!--</form>-->
              <!--login end-->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="foot">
      <div class="copyright">
        <p></p>
      </div>
    </div>
  </div>
</template>
<script>
  import axios from 'axios';
  import qs from 'qs';
  export default {
    name: 'form-horizontal',
    data() {
      return {
        logining: false,
        account: '',
        checkPass: ''
      }
    },
    methods: {
      handleSubmit2() {
        const userInfo = {
          username: this.account,
          password: this.checkPass
        };
        axios.post('http://localhost:9090/login',qs.stringify(userInfo)).then(response => {
//          if (response.data.state === 1) {
//            alert(response.data.msg);
            console.log(response.data);
//          } else if (response.data.state === 0) {
//            sessionStorage.setItem('token', response.data.token);
//            this.$router.push({path: '/index'});
//          }
        }).catch(error =>{
          console.log('error');
        })
      }
    }
  }
</script>
<!--</html>-->
<style scoped>
  /*@import '../assets/css/styles2.css';*/

  /*.comp-ie {*/
    /*width: 1200px \9;*/
    /*margin: 0 auto \9;*/
  /*}*/

  /*.login {*/
    /*background: white;*/
    /*border-top: 2px solid #5cb85c;*/
  /*}*/

  /*.login .login_title {*/
    /*margin-bottom: 25px;*/
    /*zoom: 1;*/
  /*}*/

  /*.login h4 {*/
    /*font-size: 20px;*/
    /*color: #566;*/
    /*text-align: center;*/
    /*padding-bottom: 10px;*/
    /*padding-top: 10px;*/
    /*!*margin-left: -30px;*!*/
  /*}*/

  /*.form-horizontal .form-group {*/
    /*margin-left: 10px;*/
  /*}*/

  /*.form-group span {*/
    /*margin-bottom: 5px;*/
    /*display: none;*/
    /*display: inline-block \9;*/
  /*}*/

  /*.form-group .input {*/
    /*width: 290px;*/
    /*height: 40px;*/
    /*line-height: 38px \9;*/
    /*font-size: 15px;*/
    /*text-indent: 33px;*/
    /*border: 1px solid #DDDDDD;*/
  /*}*/

  /*.form-group .icon {*/
    /*position: absolute;*/
    /*width: 27px;*/
    /*height: 38px;*/
    /*display: inline-block;*/
    /*border-left: 2px !*#037721*! #5cb85c solid;*/
  /*}*/

  /*.form-group .i_user {*/
    /*background: url(../assets/images/用户.png) no-repeat 7px 10px;*/
    /*background: none \9;*/
    /*background-size: 18px;*/
  /*}*/

  /*.form-group .i_psw {*/
    /*background: url(../assets/images/密码.png) no-repeat 7px 10px;*/
    /*background: none \9;*/
    /*line-height: 40px \9;*/
    /*background-size: 18px;*/
  /*}*/

  /*.form-group .btn-sub {*/
    /*position: relative;*/
    /*!*left: 5px;*!*/
    /*width: 290px;*/
    /*margin-top: 5px;*/
    /*font-size: 18px;*/
  /*}*/

  /*.bg-img {*/
    /*background: url(../assets/images/login-bg.jpg) no-repeat top center;*/
    /*background-size: cover;*/
    /*!*margin-top: 8px;*!*/
  /*}*/

  /*.foot {*/
    /*margin-top: 80px;*/
  /*}*/

  /*.foot .copyright {*/
    /*width: 960px;*/
    /*margin: 0 auto;*/
  /*}*/

  /*.foot .copyright p {*/
    /*font-family: "微软雅黑";*/
    /*font-size: 13px;*/
    /*width: 400px;*/
    /*margin: 0 auto;*/
  /*}*/
</style>
